<template>
    <div class="container">
        <h2>公告标题</h2>
        <div class="subtitle">发布时间: {{noticeInfo.createdTime | parseTime}} | 阅读次数: {{noticeInfo.readCount}}</div>
        <div style="height:40px"></div>
        <div class="text">{{noticeInfo.content}}</div>
        <div style="height:40px"></div>
        <div class="inscribe">校园二手交易平台</div>
        <div style="height:20px"></div>
        <div class="time">{{noticeInfo.createdTime | parseTime('{y}-{m}-{d}')}}</div>
    </div>
</template>

<script>
import { parseTime } from '@/utils'
import { noticeRestful } from '@/api/notice'

export default {
  data() {
    return {
      noticeInfo: {},
    }
  },
  created() {
    this.fetchNotices()
  },
  methods: {
    fetchNotices() {
      noticeRestful.fetchAll({ id: this.$route.query.id }).then(({ data }) => {
        this.noticeInfo = this._.get(data, '0');
      })
    }
  },
  filters: {
    parseTime
  },
}
</script>

<style>
    /* .main{
        height: 2000px;
    } */
    .container{
        width:100%;
        margin-top: 5%;
        text-align: center;
    }
    .title{
        text-align: center;
        font-size:24px;
        margin-top:30px
    }
    .subtitle{
        margin-left: 400px;
        text-align: left;
        font-size:14px  
    }
    .text{
        margin-left: 400px;
        text-align: center;
        width:800px;
        line-height: 30px;
    }
    .inscribe{
        margin-right: 400px;
        text-align: right;
    }
    .time{
        margin-right: 400px;
        text-align: right;
    }
</style>
